package io.litchi.starter.oss.autoconfig;

import io.litchi.starter.oss.LitchiOssClient;
import io.litchi.starter.oss.impl.LitchiOssClientImpl;
import io.litchi.starter.oss.properties.LitchiOssProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 自动装配
 *
 * @author helang
 * @since 2025-09-20
 */
@Configuration
@EnableConfigurationProperties(LitchiOssProperties.class)
@ConditionalOnClass(LitchiOssClient.class)
public class LitchiOssAutoConfig {

    @Bean
    @ConditionalOnMissingClass
    public LitchiOssClient ossClient(LitchiOssProperties properties) {
        return new LitchiOssClientImpl(properties);
    }
}